﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TtfLibrary
{
    [TtfStructure]
    public class TtfLongHorMetric
    {
        public UInt16 AdvanceWidth;
        public Int16 Lsb;
    }

    public class OttHmtx
    {
        public List<TtfLongHorMetric> HMetrics = new List<TtfLongHorMetric>();
        public List<Int16> LeftSideBearing = new List<Int16>();

        public void Read(TtfStructureReader reader, int numOfHMetrics, int numGlyphs)
        {
            for (int i = 0; i < numOfHMetrics; i++)
                HMetrics.Add(reader.Read<TtfLongHorMetric>());

            var leftSideBearingCount = numGlyphs - numOfHMetrics;
            for (int i = 0; i < leftSideBearingCount; i++)
                LeftSideBearing.Add(reader.ReadScalarType<Int16>());
        }
    }
}
